package com.client.job.core.constant;

import java.util.ArrayList;
import java.util.List;

/**
 * 任务分片策略
 * @des
 * @author mengxiangzhong
 * @date 2021年9月18日
 *
 */
public enum JobZoneEnums {
	NO(0,"不分片"),
	TIME_ZONE(1,"时间分片"),
	HASH_ZONE(2,"hash分片");
	
	private Integer code;
	private String msg;	
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	private JobZoneEnums(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	
	
	public static List<JobZoneEnums>  getZoneByCode(Integer code) {
		List<JobZoneEnums>  jzList = new ArrayList<>();
		if(code == null ) {
			for(JobZoneEnums jz : JobZoneEnums.values()) {
				jzList.add(jz);
			}
		}else {
			for(JobZoneEnums jz : JobZoneEnums.values()) {
				if(jz.getCode() == code) {
					jzList.add(jz);
				}			
			}
		}
		return jzList;
	}
	
	
	

}
